<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
  <head>
    <title>新想法</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
  </head>
  
  <body>
    <%@include file="include/topbar.jsp" %>
	<div class="container" style="margin-top: 60px">
			<div class="row">
				<jsp:include page="include/left.jsp">
					<jsp:param value="idea" name="tag"/>
				</jsp:include>
	<div class="span9">
        <fieldset>
          <legend>发表新想法</legend>
          <div class="control-group">
            <label for="input01" class="control-label">标题</label>
            <div class="controls">
              <input type="text" x-webkit-speech="undefined" id="input01" class="span9">
            </div>
          </div>
		  <div class="control-group">
            <label for="input02" class="control-label">内容</label>
            <div class="controls">
              <textarea rows="15" class="span9" id="input02"></textarea>
            </div>
          </div>

          <div class="form-actions">
            <button class="btn btn-primary" id="saveidea">保存</button>
            <button onclick="location.back()" class="btn">返回</button>
          </div>
        </fieldset>
	</div>
	</div>
	</div>
	
	<script type="text/javascript">
		$(function() {
			$("#saveidea").click(function() {
				var title = $("#input01").val();
				var content = $("#input02").val();
				
				if(title.trim() != "" || content.trim() != "") {
					$.ajax({
						url : 'newidea.jspx',
						type : 'POST',
						data : {
							title : title,
							content : content
						}
					}).done(function(msg) {
						if(msg == 10001) {
							window.location.href = "idea.jspx";
						} else {
							alert("添加失败");
						}
					});
				} else {
					alert("不能为空");
				}
			});
		});
	</script>
</body>
</html>